#define _CRT_SECURE_NO_WARNINGS 1
// https://www.nowcoder.com/share/jump/9466535261705084180035

#include <stdio.h>

struct ListNode {
    int val;
    struct ListNode* next;
};
typedef struct ListNode ListNode;
ListNode* FindKthToTail(ListNode* pListHead, int k) {
    if (pListHead != NULL && k > 0) {
        ListNode* slow = pListHead;
        ListNode* quick = pListHead;
        while (k--) { // quick && k--
            if (quick == NULL) {
                return NULL;
            }
            quick = quick->next;
        } // if (k > 0) return NULL;
        while (quick) {
            slow = slow->next;
            quick = quick->next;
        }
        return slow;
    }
    return NULL;
}